package Demo11;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class StudentDAO {
    //得到数据库连接
    private Connection conn;
    public  StudentDAO() throws SQLException, ClassNotFoundException {
        //实例化--连接
        conn=SqlHelper.getConn();
    }
    //添加记录
    public  void  add(student stu) throws SQLException {
        String sql="insert into student values('"+stu.getStuId()+"','"+stu.getStuName()+"','"+stu.getStuSex()+"','"+stu.getStuAge()+"',)";
        Statement state =conn.createStatement();
        state.executeUpdate(sql);


    }

}
